package com.anysoft.utils;

import android.content.Context;
import android.content.Intent;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import com.anysoft.R;
import com.anysoft.web.AgreementActivity;

/**
 * Created by wwq on 2017/2/28.
 * 超链接类
 */

public class IcbcClickableSpan extends ClickableSpan {

    private String string;
    private Context context;
    private int stype;

    public IcbcClickableSpan(String string, Context context, int stype) {
        this.string = string;
        this.context = context;
        this.stype = stype;
    }

    @Override
    public void updateDrawState(TextPaint ds) {
        ds.setColor(context.getResources().getColor(R.color.blue_tips));
    }

    @Override
    public void onClick(View widget) {
        Intent intent = new Intent(context, AgreementActivity.class);
        switch (stype) {
            case 1:
                intent.putExtra("html", "DZJYFW.html");
                break;
            case 2:
                intent.putExtra("html", "QYXZ.html");
                break;
            case 3:
                intent.putExtra("html", "ZXHBJJKSSH.html");
                break;
            default:
                break;
        }
        context.startActivity(intent);
    }
}
